<template>
  <d-dialog
    ref="dialog"
    :header="'操作日志详细'"
    v-model:data="formData"
    v-model:visible="visible"
    :width="700"
    layout="inline"
    :footer="null"
  >
    <t-form-item label="操作模块" class="w-45%">
      {{ formData.title }} / {{ formData.businessType }}
    </t-form-item>
    <t-form-item label="请求地址" class="w-45%">
      {{ formData.operUrl }}
    </t-form-item>
    <t-form-item label="登录信息" class="w-45%">
      {{ formData.operName }} / {{ formData.operIp }}
    </t-form-item>
    <t-form-item label="请求方式" class="w-45%">
      {{ formData.requestMethod }}
    </t-form-item>
    <t-form-item label="操作方法" class="w-90%">
      {{ formData.method }}
    </t-form-item>
    <t-form-item label="请求参数" class="w-90%">
      {{ formData.operParam }}
    </t-form-item>
    <t-form-item label="返回参数" class="w-90%">
      {{ formData.jsonResult }}
    </t-form-item>
    <t-form-item label="操作状态" class="w-45%">
      {{ formData.status }}
    </t-form-item>
    <t-form-item label="消耗时间" class="w-45%"> {{ formData.costTime }} 毫秒 </t-form-item>
    <t-form-item label="操作时间" class="w-45%">
      {{ formData.operTime }}
    </t-form-item>
  </d-dialog>
</template>

<script setup>
import { ref, computed } from 'vue'
import { useDict } from '@/store/dict'
const dialog = ref(null)
const visible = ref(false)
const formData = ref({})

const dict = useDict()
const operType = computed(() => {
  return dict.dict_oper_type
})
const commonStatus = computed(() => {
  return dict.dict_success_list
})
const show = (info = {}) => {
  formData.value = {
    ...info,
    businessType: operType.value.find((e) => e.value == info.businessType)?.label,
    status: commonStatus.value.find((e) => e.value == info.status)?.label
  }
  visible.value = true
}
dict.getSysOperType()
defineExpose({ show })
</script>
